/*
 * @Author: zh 18812415351@163.com
 * @Date: 2023-08-18 17:33:19
 * @LastEditors: zh 18812415351@163.com
 * @LastEditTime: 2023-08-25 13:02:30
 * @FilePath: \WEB_MANAGEe:\AAAydl\项目\billiard\and\manage_client\main.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import App from './App'

// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'

import uView from '@/uni_modules/uview-ui'
import empty from	'./components/empty/empty.vue'
import { debounceConfig, debounceMixin } from './utils/debouncePlugin.js';

Vue.mixin(debounceMixin);
Vue.prototype.$debounceConfig = debounceConfig;

Vue.component('empty',empty)
Vue.use(uView)
import store from './store'
Vue.prototype.$store = store
Vue.prototype.$navBar = {
    titleTextSize: '36rpx'
}
try {
  function isPromise(obj) {
    return (
      !!obj &&
      (typeof obj === "object" || typeof obj === "function") &&
      typeof obj.then === "function"
    );
  }

  // 统一 vue2 API Promise 化返回格式与 vue3 保持一致
  uni.addInterceptor({
    returnValue(res) {
      if (!isPromise(res)) {
        return res;
      }
      return new Promise((resolve, reject) => {
        res.then((res) => {
          if (res[0]) {
            reject(res[0]);
          } else {
            resolve(res[1]);
          }
        });
      });
    },
  });
} catch (error) { }

const app = new Vue({
	store,
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif